<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>瑞成火锅</title>
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
  <link href="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
  <script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    html {
      height: 100%;
    }

    body {
      background-image: linear-gradient(to bottom right, rgb(114, 135, 254), rgb(130, 88, 186));
    }

    .login-container {
      width: 600px;
      height: 315px;
      margin: 0 auto;
      margin-top: 10%;
      border-radius: 15px;
      box-shadow: 0 10px 50px 0px rbg(59, 45, 159);
      background-color: rgb(95, 76, 194);
    }

    .left-container {
      display: inline-block;
      width: 400px;
      border-top-left-radius: 15px;
      border-bottom-left-radius: 15px;
      padding: 32px 60px;
      background-image: linear-gradient(to bottom right, rgb(118, 76, 163), rgb(92, 103, 211));
    }

    .title {
      color: #fff;
      font-size: 18px;
      font-weight: 200;
    }

    .title span {
      border-bottom: 3px solid rgb(237, 221, 22);
    }

    .input-container {
      padding: 20px 0;
    }

    input {
      border: 0;
      background: none;
      outline: none;
      color: #fff;
      margin: 20px 0;
      display: block;
      width: 100%;
      padding: 5px 0;
      transition: .2s;
      border-bottom: 1px solid rgb(199, 191, 219);
    }

    input:hover {
      border-bottom-color: #fff;
    }

    ::-webkit-input-placeholder {
      color: rgb(199, 191, 219);
    }

    .message-container {
      font-size: 14px;
      transition: .2s;
      color: rgb(199, 191, 219);
      cursor: pointer;
    }

    .message-container:hover {
      color: #fff;
    }

    .right-container {
      width: 145px;
      display: inline-block;
      height: calc(100% - 120px);
      vertical-align: top;
      padding: 60px 0;
    }

    .regist-container {
      text-align: center;
      color: #fff;
      font-size: 18px;
      font-weight: 200;
    }

    .regist-container span {
      border-bottom: 3px solid rgb(237, 221, 22);
    }

    .action-container {
      font-size: 10px;
      color: #fff;
      text-align: center;
      position: relative;
      top: 200px;
    }

    .action-container span {
      border: 1px solid rgb(237, 221, 22);
      padding: 10px;
      display: inline;
      line-height: 20px;
      border-radius: 20px;
      position: absolute;
      bottom: 10px;
      left: calc(72px - 20px);
      transition: .2s;
      cursor: pointer;
    }

    .action-container span:hover {
      background-color: rgb(237, 221, 22);
      color: rgb(95, 76, 194);
    }
    a {
      color: #fff;
      text-decoration: none;
      font-weight: 500;
    }
    a:hover {
      color: #fff;
    }
  </style>
</head>

<body>
  <div id="login">
    <div class="login-container">
      <div class="left-container">
        <div class="title"><span>注册</span></div>
        <div class="input-container">
          <input type="text" v-model="ruleForm.acccount" placeholder="账号">
          <input type="password" v-model="ruleForm.password" placeholder="密码">
          <input type="password" v-model="pass" placeholder="再次输入密码">
        </div>
        <div class="message-container">
        </div>
      </div>
      <div class="right-container">
        <div class="regist-container">
          <span class="regist"><a href="./login.html">登录</a></span>
        </div>
        <div class="action-container" @click="register()">
          <span>提交</span>
        </div>
      </div>
    </div>
  </div>
</body>
<script>
  new Vue({
    el: '#login',
    data() {
      return {
        pass: '',
        ruleForm: {},
      }
    },
    methods: {
      async register(){
        if(this.pass !== this.ruleForm.password){
          this.$message.error("两次输入的密码不一致！");
          return;
        }
        const {data : result} = await this.$http.post("http://localhost:9092/hot_userback/register",this.ruleForm);
        if(result.flag){
          this.$message.success(result.message);
          window.location.href = './login.html';
        }else {
          this.$message.error(result.message);
        }
      }
    }
  })
</script>
</html>